<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('查看推送任务')" />
    <th:block th:include="include :: ztree-css" />
    <th:block th:include="include :: select2-css" />
    <th:block th:include="include :: bootstrap-select-css" />
    <th:block th:include="include :: daterangepicker-css" />

</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-itemInfo-edit" th:object="${specialCostomItemInfo}">
            <input th:field="*{id}" id="itemInfoId" type="hidden">

            <div class="rows">
                <div class="col-sm-4" >
                    <div class="form-group">
                        <label class="col-sm-3 control-label">描述：</label>
                        <div class="col-sm-8">
                            <textarea rows="3"  cols="40" name="descInfo" th:field="*{descInfo}" placeholder="该任务的描述信息"></textarea>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-3 control-label">价格：</label>
                        <div class="col-sm-8">
                            <input name="priceAmount" th:field="*{priceAmount}" class="form-control" type="text">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-3 control-label">每日推送量：</label>
                        <div class="col-sm-8">
                            <input name="pushNumber" th:field="*{pushNumber}" class="form-control" type="text" placeholder="每日推送的最多数量（eg:100）">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-3 control-label">每日推送时间：</label>
                        <div class="col-sm-4 row" id="timeRange">
                            <input name="starttime" id="starttime" th:field="*{starttime}" class="form-control" type="text" placeholder="开始时间">
                        </div>
                        <div class="col-sm-4">
                            <input name="endtime" id="endtime" th:field="*{endtime}" class="form-control" type="text" placeholder="结束时间">
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-sm-3 control-label">年龄：</label>
                        <div class="col-sm-3">
                            <input name="minAge" class="form-control"  th:field="*{minAge}" type="text" placeholder="最小年龄" autocomplete="off" value="20">
                        </div>
                        <div class="col-sm-3">
                            <input name="maxAge" class="form-control" th:field="*{maxAge}" type="text" placeholder="最大年龄" autocomplete="off" value="60">
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-sm-3 control-label">允许推送的渠道信息：</label>
                        <input type="hidden" th:field="*{inChannelArray}" id="inChannelArrayInput" />
                        <div class="col-sm-8">
                            <select name="inChannelArray"
                                    data-none-selected-text="123"
                                    data-height="600"
                                    class="form-control select2-multiple"
                                    data-dismiss="false" style="height: 600px"
                                    multiple="multiple" data-live-search="true"
                                    th:field="*{inChannelArray}">
                                <option  th:each="item:${channelInfoList}" th:text="${item.name}" th:value="${item.value}" ></option>
                            </select>
                        </div>
                    </div>

                    <!-- 不允许推送的渠道信息 -->
                    <div class="form-group">
                        <label class="col-sm-3 control-label">不允许推送的渠道信息：</label>
                        <input type="hidden" th:field="*{outChannelArray}" id="outChannelArrayInput" />
                        <div class="col-sm-8">
                            <select name="outChannelArray"
                                    data-none-selected-text="请选择"
                                    data-height="600"
                                    class="form-control select2-multiple"
                                    multiple="multiple"
                                    data-live-search="true"
                                    style="height: 600px;"
                                    th:field="*{outChannelArray}">
                                <option th:each="item : ${channelInfoList}"
                                        th:value="${item.value}"
                                        th:text="${item.name}"></option>
                            </select>
                        </div>
                    </div>


                    <div class="form-group">
                        <label class="col-sm-3 control-label">允许推送的流量类型：</label>
                        <input type="hidden" th:field="*{inFlowRateType}" id="inFlowRateTypeInput" />
                        <div class="col-sm-8">
                            <select name="inFlowRateType"
                                    data-height="600"
                                    class="form-control select2-multiple"
                                    multiple="multiple"
                                    data-live-search="true"
                                    style="height: 600px;"
                                    th:field="*{inFlowRateType}">
                                <!-- 渲染所有渠道信息 -->
                                <option th:each="item : ${flowRateTypeList}"
                                        th:value="${item.value}"
                                        th:text="${item.name}"></option>
                            </select>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-3 control-label">不允许推送的流量类型：</label>
                        <input type="hidden" th:field="*{outFlowRateType}" id="outFlowRateTypeInput" />
                        <div class="col-sm-8">
                            <select name="outFlowRateType"
                                    data-height="600"
                                    class="form-control select2-multiple"
                                    multiple="multiple"
                                    data-live-search="true"
                                    style="height: 600px;"
                                    th:field="*{outFlowRateType}">
                                <!-- 渲染所有渠道信息 -->
                                <option th:each="item : ${flowRateTypeList}"
                                        th:value="${item.value}"
                                        th:text="${item.name}"></option>
                            </select>
                        </div>
                    </div>

                    <!--                    用户条件筛选-->
                    <div class="form-group" th:each="item:${multiInfoList}">
                        <label class="col-sm-3 control-label" th:text="${item.name} + ':'">:</label>
                        <div class="col-sm-8">
                            <label class="check-box" th:each="child:${item.childInfoList}">
                                <input type="checkbox" lay-skin="primary" th:checked="${child.checked}" th:name="${item.elemName}" th:value="${child.value}" th:text="${child.name}" >
                            </label>
                        </div>
                    </div>
                </div>

                <div class="col-sm-4">
                    <input type="hidden" name="cityName" id="cityName" />
                    <div class="form-group">
                        <label class="col-sm-3 control-label">推送的省市：</label>
                        <div class="col-sm-8">
                            <div id="addressTrees" class="ztree ztree-border"></div>
                        </div>
                    </div>
                </div>

                <div class="col-sm-4">
                    <input type="hidden" name="outCityArray" id="outCityArray" />
                    <div class="form-group">
                        <label class="col-sm-3 control-label">不推送的省市：</label>
                        <div class="col-sm-8">
                            <div id="addressTrees1" class="ztree ztree-border"></div>
                        </div>
                    </div>
                </div>
            </div>

        </form>
    </div>
    <th:block th:include="include :: footer" />
    <th:block th:include="include :: ztree-js" />
    <th:block th:include="include :: select2-js" />
    <th:block th:include="include :: daterangepicker-js" />
    <th:block th:include="include :: bootstrap-select-js" />
    <script th:inline="javascript">
        var prefix = ctx + "special/itemInfo";
        /***
         * 推送的城市信息
         */
        $(function() {
            var url = prefix + "/inCity?itemInfoId=" + $("#itemInfoId").val();
            var options = {
                id: "addressTrees",
                url: url,
                check: { enable: true, chkboxType: { "Y": "", "N": "" } },
                expandLevel: 0
            };
            $.tree.init(options);
        });

        $("#inChannelArray").val($("#inChannelArrayInput").val().split(',')).trigger('change')
        $("#outChannelArray").val($("#outChannelArrayInput").val().split(',')).trigger('change')

        $("#inFlowRateType").val($("#inFlowRateTypeInput").val().split(',')).trigger('change')
        $("#outFlowRateType").val($("#outFlowRateTypeInput").val().split(',')).trigger('change')


        /***
         * 不推送的城市信息
         */
        $(function() {
            var url = prefix + "/outCity?itemInfoId=" + $("#itemInfoId").val();
            var options = {
                id: "addressTrees1",
                url: url,
                check: { enable: true, chkboxType: { "Y": "", "N": "" } },
                expandLevel: 0
            };
            $.tree.init(options);
        });
    </script>
</body>
</html>